package com.ksv.qlsv;

import com.ksv.lop.ConnectDB;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class QLSinhVienActivity extends Activity {
	
	public static ConnectDB connect = null;
    private Button btn_khoa;
	private Button btn_sinh_vien;
	private Button btn_mon_hoc;
	private Button btn_hoc_ky;
	
	public int _id = 1;
	private Button btn_lop;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        // TODO
        if(connect == null){ 
        	connect = new ConnectDB(this);
	        setPropertyButton();
        }
    }

	private void setPropertyButton(){
		
    	 int iTextSize = getResources().getInteger(R.integer.size);
    	 
    	 btn_khoa = (Button)findViewById(R.id.btn_khoa);
         btn_khoa.setTextSize((float)iTextSize);
         btn_khoa.setTextColor(getResources().getColor(R.color.color_btn));
         btn_khoa.setBackgroundResource(R.color.background_btn);
         
         btn_lop = (Button)findViewById(R.id.btn_lop_hoc);
         btn_lop.setTextSize((float)iTextSize);
         btn_lop.setTextColor(getResources().getColor(R.color.color_btn));
         btn_lop.setBackgroundResource(R.color.background_btn);
         
         btn_sinh_vien = (Button)findViewById(R.id.btn_sinh_vien);
         btn_sinh_vien.setTextSize((float)iTextSize);
         btn_sinh_vien.setTextColor(getResources().getColor(R.color.color_btn));
         btn_sinh_vien.setBackgroundResource(R.color.background_btn);
         
         btn_mon_hoc = (Button)findViewById(R.id.btn_mon_hoc);
         btn_mon_hoc.setTextSize((float)iTextSize);
         btn_mon_hoc.setTextColor(getResources().getColor(R.color.color_btn));
         btn_mon_hoc.setBackgroundResource(R.color.background_btn);
         
         btn_hoc_ky = (Button)findViewById(R.id.btn_hoc_ky);
         btn_hoc_ky.setTextSize((float)iTextSize);
         btn_hoc_ky.setTextColor(getResources().getColor(R.color.color_btn));
         btn_hoc_ky.setBackgroundResource(R.color.background_btn);

    }
    
    private void fnResetAllBackground(){
    	btn_khoa.setBackgroundResource(R.color.background_btn);
    	btn_sinh_vien.setBackgroundResource(R.color.background_btn);
    	btn_mon_hoc.setBackgroundResource(R.color.background_btn);
    	btn_hoc_ky.setBackgroundResource(R.color.background_btn);
    	btn_lop.setBackgroundResource(R.color.background_btn);
    }

	public void btn_khoa_click(View view) {
		// TODO Auto-generated method stub
		if(view.getId() == R.id.btn_khoa){
			fnResetAllBackground();
			Button btn = (Button)view;
			btn.setBackgroundResource(R.color.color_btn_click);
			Intent intent = new Intent(this, KhoaActivity.class);
			startActivity(intent);
		}
	}
	
	public void btn_lop_click(View view) {
		// TODO Auto-generated method stub
		if(view.getId() == R.id.btn_lop_hoc){
			fnResetAllBackground();
			Button btn = (Button)view;
			btn.setBackgroundResource(R.color.color_btn_click);
			Intent intent = new Intent(this, LopHocActivity.class);
			startActivity(intent);
		}
	}
	
	public void btn_sinh_vien_click(View view) {
		// TODO Auto-generated method stub
		if(view.getId() == R.id.btn_sinh_vien){
			fnResetAllBackground();
			Button btn = (Button)view;
			btn.setBackgroundResource(R.color.color_btn_click);
			Intent intent = new Intent(this, SinhVienActivity.class);
			startActivity(intent);
		}
	}
	
	public void btn_mon_hoc_click(View view) {
		// TODO Auto-generated method stub
		if(view.getId() == R.id.btn_mon_hoc){
			fnResetAllBackground();
			Button btn = (Button)view;
			btn.setBackgroundResource(R.color.color_btn_click);
			Intent intent = new Intent(this, MonHocActivity.class);
			startActivity(intent);
		}
	}
	
	public void btn_hoc_ky_click(View view) {
		// TODO Auto-generated method stub
		if(view.getId() == R.id.btn_hoc_ky){
			fnResetAllBackground();
			Button btn = (Button)view;
			btn.setBackgroundResource(R.color.color_btn_click);
			Intent intent = new Intent(this, HocKyActivity.class);
			startActivity(intent);
		}
	}
	
}